This section shows how to do a sample for a correct E-mail address entry.Example:
Code inserted in heading HTML of page (before < /head >):
<script language="JavaScript">
<!--
function showerror(){
alert("E-mail address is entered incorrectly.");
}
function checkmail(){
txt=document.entermail.address.value;
if (txt == "") {
alert("Enter your E-mail address.");
return(false)
}
if (txt.indexOf(".") == -1) {
alert("Symbol \".\" is missed.");
return(false)
}
dog = txt.indexOf("@");
if (dog == -1) {
alert("Symbol \"@\" is missed.");
return(false)
}
if ((dog < 1) || (dog > txt.length - 5)) {
showerror();
return(false)
}
if ((txt.charAt(dog - 1) == '.') || (txt.charAt(dog + 1) == '.')) {
showerror();
return(false)
}
}
// -->
</script>
</head>
Example of form code:
<form method="POST" name="entermail" onSubmit="return checkmail()">
<p><b><small>Введите E-mail адрес:<br>
</small></b><input type="text" name="address" size="20"><br>
<input type="submit" name="B1"> * <input type="reset" name="B2"></p>
</form>